chrome.extension.onMessage.addListener(
    function(request, sender, sendResponse) {

    	// 自动填充用户名密码自动提交跳转    	
//    	if(location.href.indexOf('www.cdtye.com:83/Login.aspx') != -1){
//    		$('#txt_Username').val('...');
//    		$('#txt_Password').val('...');
//    		$('#btn_Login').click();
//    		return;
//    	}
    	
    	var commonUrl = 'http://www.cdtye.com:83/OASystem/PersonalOffice/WorkdailyEdit.aspx?Deptid=1001&Modelid=126&OptType=ADD';
    	if(window.location.href.indexOf(commonUrl) == -1){
    		
    		$('.ahoireportchromeplugindiv').remove();
    		var tipH = '<div class="ahoireportchromeplugindiv"><div>检测到本页面不是ERP系统，正在跳转.</div></div>'
    		$('body').append(tipH);
    		
    		$('.ahoireportchromeplugindiv').css({
    			position:'absolute',
    			top:0,
    			right:0,
    			bottom:0,
    			left:0
    		});
    		$('.ahoireportchromeplugindiv div').css({
    			boxShadow:'#666 0px 0px 30px',
    			position:'absolute',
    			top:'10%',
    			left:'10%',
    			width:550,
    			fontSize:40,
    			backgroundColor:'#dcdcdc',
    			padding:15,
    			borderRadius:10,
    			zIndex:999,
    			color:'#286177',
    			overflow: 'hidden',
    			textAlign: 'left'
    		});
    		
    		setInterval(function(){
    			$('.ahoireportchromeplugindiv div').text($('.ahoireportchromeplugindiv div').text() + '.');	
    		}, 200);
    		
			setTimeout(function(){
				location.href = commonUrl;
			}, 2000);
    		return;
    	}

    	var workDate = request.workDate;
    	var params = request.params;
    	
    	$('[name$=txt_Projectnamecode]').val(params.name);
    	$('[name$=txt_Projectid]').val(params.id);
    	$('[name$=txt_Workdate]').val(workDate);
    	$('[name$=txt_Workhouse]').val(params.gs);
    	$('[name$=txt_Worklocation]').val(params.dd);
    	$('[name$=txt_Workcontent]').val(params.nr);
    	$('[name$=txt_Projectfollow]').val(params.gj);
    	$('[name$=txt_Createtime]').val(workDate+' 17:30:00');
    	$('[name$=txt_Memo]').val(params.bz);
    	
    	var sucH = '<div style="font-size:40px;">'+workDate+'日报注入成功！</div>';
    	$('#desktop').append(sucH);
    	
    	setTimeout(function(){
			$('#NavContent_btn_Save').click();
		}, 1200);
    	
    	
    	
    	
    }
    
);